
#include <string.h>
#include <stdio.h>
#include <Windows.h>
#include <assert.h>

#include "StlcCom.h"

#ifndef   TMB_APP
void LogOutA( char *a_cModuleName, int a_nDbgLogGrade, const char *a_pcFileName, const char *a_pcOutText, ... )
{
	va_list arglist;
	char    cOutText[2048] = {0};
	char    cFilePath[512] = {'\0'};
	if( NULL != a_pcFileName && NULL != a_pcOutText )
	{
		FILE *hLogFile = NULL;
		char *pcStrChr = NULL;
		GetModuleFileNameA( NULL, cFilePath, MAX_PATH );
		pcStrChr = strrchr( cFilePath, '\\' );
		if( NULL != pcStrChr )
		{
			*++pcStrChr = '\0';
			strcat( cFilePath, a_pcFileName );
			hLogFile = fopen( cFilePath, "a+" );	
			va_start( arglist, a_pcOutText );
			if( 0 != hLogFile )
			{	
				vsprintf( cOutText, a_pcOutText, arglist );
				fprintf( hLogFile, "%s", cOutText );
				fclose( hLogFile );
			}
			va_end( arglist );
		}		
	}	
}
#endif
